home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
hsrc_117.zip
/
HEAD2.C
< prev
next >
Wrap
Text File
|
1990-11-09
|
19KB
|
780 lines
/* HeadEdit XBBS message area reader -- Nodelist functions, header
editor, miscellaneous functions */
/* Note this stuff needs to stay together as there is some really sloppy
sharing of windows and such (bleagh!) */
#include "msgg.h"
#include "twindow.h"
#include "keys.h"
#include "headedit.h"
extern WINDOW *ewnd;
static char attrprompts[16][12]={
"Private:",
"Crash:",
"Read:",
"Sent:",
"File:",
"Forward:",
"Orphan:",
"Kill:",
"Local:",
"XX1:",
"XX2:",
"FReq:",
"RReq:",
"Receipt:",
"Audit Rq:",
"Update Rq:"
};
static char mattrprompts[][12]={
"Deleted:",
"Anonymous:",
"Echo:",
"Net:",
"Hold:",
"Host Rt:",
"Scanned:",
"Keep:",
"Treated:",
"Packed:"
};
void pascal node_lister (void) {
static char zone[7]="";
static char net[7]="";
char lines;
struct nodeidx nid;
int returncode;
FIELD *fld;
if(!nidxsize || !nidx) {
any_message(" No nodelist available. ");
pause();
return;
}
wnd6=establish_window(4,maxy-7,5,31);
set_border(wnd6,3);
set_title(wnd6," Nodelist Scanner ");
set_colors(wnd6,BORDER,7,0,0);
display_window(wnd6);
wcursor(wnd6,0,0);
wprintf(wnd6," F10 to list or ESC to abort");
if (!*zone || !(word)atol(zone)) {
sprintf(zone,"%u",curaddress.zone);
sprintf(net,"%u",curaddress.net);
}
init_template(wnd6);
wprompt(wnd6,1,1,"Zone:");
wprompt(wnd6,1,2,"Net:");
fld=establish_field(wnd6,7,1,msk5,zone,'N');
field_window(fld,"zone ",40,6);
fld=establish_field(wnd6,7,2,msk5,net,'N');
field_window(fld,"net ",40,5);
prep_template(wnd6);
NodeOver:
returncode=data_entry(wnd6);
if (returncode==ESC){
delete_window(wnd6);
return;
}
if (returncode!=F10) goto NodeOver;
if (atol(zone)<1 || atol(zone)>65535L || atol(net)>65535L) {
error_message(" Invalid value(s)...zone=1-65535, net=0-65535 ");
pause();
goto NodeOver;
}
nid.zone=(word)atol(zone);
nid.net=(word)atol(net);
delete_window(wnd6);
nid.node=0;
nid.type=255;
wnd4=establish_window(0,0,maxy,maxx);
set_border(wnd4,1);
set_title(wnd4," NodeList ");
display_window(wnd4);
wcursor(wnd4,0,0);
any_message(" Searching ");
if (!nid.net) {
if (nodelist(&nid,3)==-1) goto BreakOut;
clear_message();
nid.type=3;
lines=2;
while(nodelist(&nid,4)>(-1)) {
lines+=2;
if (lines>=(maxy-3)) {
any_message("More? (Y-n)");
lines=toupper(generic_mouse_input(ewnd));
clear_message();
if (lines=='S' || lines=='N' || lines==ESC) goto BreakOut;
lines=0;
}
}
any_message(" Complete ");
pause();
goto BreakOut;
}
clear_message();
if (nodelist(&nid,1)==-1) goto BreakOut;
nid.type=0;
lines=2;
while(nodelist(&nid,2)>(-1)) {
lines+=2;
if (lines>=(maxy-3)) {
any_message("More? (Y-n)");
lines=toupper(generic_mouse_input(ewnd));
clear_message();
if (lines=='S' || lines=='N' || lines==ESC) goto BreakOut;
lines=0;
}
}
any_message(" Complete ");
generic_mouse_input(ewnd);
BreakOut:
clear_message();
delete_window(wnd4);
}
int pascal nodelist (struct nodeidx *nii,char type) {
struct nodeinfo nif;
char temp[91];
int handle;
long x;
static long cidx=0;
WINDOW *fake;
char len;
if(!nidxsize || !nidx) {
any_message(" No nodelist available. ");
return (-1);
}
if (nii->zone==0) {
nii->zone=curaddress.zone;
}
nif.zone=nii->zone;
nif.net=nii->net;
nif.node=nii->node;
nif.type=nii->type;
if (type==2 || type==4) {
x=cidx;
if (type==2) goto GotwhatIwant;
}
else x=cidx=0;
if (type==3 || type==4) {
if (type==4) {
x++;
cidx=x;
}
for (;x<(nidxsize+1);x++) {
if (nidx[x].zone==nif.zone && nidx[x].node==0) break;
}
cidx=x;
goto GotwhatIwant;
}
for (;x<(nidxsize+1);x++) {
if (nidx[x].zone==nif.zone && nidx[x].net==nif.net && nidx[x].node==nif.node) break;
}
cidx=x;
GotwhatIwant:
if (x>nidxsize) {
if (!type) {
wnd6=establish_window(3,maxy-5,4,maxx-6);
set_border(wnd6,3);
set_title(wnd6," Node Info ");
set_colors(wnd6,BORDER,7,0,0);
display_window(wnd6);
wcursor(wnd6,1,1);
wprintf(wnd6,"\t\t\t\tRequested Node not found. ");
}
return (-1);
}
if (type==2 || type==4) {
if (type==2) {
x++;
cidx=x;
}
if (x>nidxsize) return (-1);
if (type==2 && (nidx[x].zone!=nif.zone || nidx[x].net!=nif.net)) return (-1);
if (type==4 && (nidx[x].zone!=nif.zone || nidx[x].node!=0)) return (-1);
}
sprintf(temp,"%sQNL_DAT.BBS",nodepath);
if ((handle=_open(temp,O_RDONLY | O_BINARY | O_DENYNONE))==-1) {
error_message(" Can't open QNL_DAT.BBS ");
pause();
return(-1);
}
lseek(handle,x*(long)sizeof(struct nodeinfo),SEEK_SET);
if (_read(handle,&nif,sizeof(struct nodeinfo))<1) {
_close(handle);
goto ReadError;
}
_close(handle);
len=*nif.name;
memmove(nif.name,&nif.name[1],len);
nif.name[len]=0;
len=*nif.city;
memmove(nif.city,&nif.city[1],len);
nif.city[len]=0;
len=*nif.phone;
memmove(nif.phone,&nif.phone[1],len);
nif.phone[len]=0;
len=*nif.password;
memmove(nif.password,&nif.password[1],len);
nif.password[len]=0;
if (!type) {
wnd6=establish_window(3,maxy-5,5,maxx-6);
set_border(wnd6,3);
set_title(wnd6," Node Info ");
set_colors(wnd6,BORDER,7,0,0);
wcursor(wnd6,1,1);
fake=wnd6;
display_window(fake);
}
else fake=wnd4;
wprintf(fake,"\n");
wprintfraw(fake,"Type:%hd * %u:%u/%u (%s, %s)\n",nif.type,nif.zone,nif.net,nif.node,nif.name,nif.city);
wprintfraw(fake,"%s * %s * %u baud * %d cost * ",nif.phone,nif.password,nif.baud,nif.cost);
if (nif.flags & B_hub) wprintf(fake,"Hub ");
if (nif.flags & B_host) wprintf(fake,"Host ");
if (nif.flags & B_region) wprintf(fake,"RC ");
if (nif.flags & B_zone) wprintf(fake,"ZC ");
if (nif.flags & B_CM) wprintf(fake,"CM");
return(nif.cost);
ReadError:
error_message(" Error reading record ");
pause();
return (-1);
}
int dest_check (char *bf,int key) {
struct nodeidx nid;
if (!autocheck && *bf) return 0;
if ((currarea->attr & NET)==0 && (currarea->attr & ALTERNATE)==0) return 0;
nid.node=(word)atol(dest);
nid.net=(word)atol(dest_net);
nid.zone=(word)atol(d_zone);
clear_message();
nid.type=255;
sprintf(cost,"%-5d",nodelist(&nid,0));
if (*cost=='-') strcpy(cost,"0 ");
pause();
delete_window(wnd6);
if(wnd1)normal_video(wnd1);
if(wnd1)field_tally(wnd1);
if(wnd1)reverse_video(wnd1);
return 0;
}
int orig_check (char *bf,int key) {
struct nodeidx nid;
if (!autocheck) return 0;
if ((currarea->attr & NET)==0 && (currarea->attr & ALTERNATE)==0) return 0;
nid.node=(word)atol(orig);
nid.net=(word)atol(orig_net);
nid.zone=(word)atol(o_zone);
clear_message();
nid.type=255;
nodelist(&nid,0);
pause();
delete_window(wnd6);
return 0;
}
void find_sysop (char *bf) {
int fp;
char s[128];
char *p;
char first[36];
char last[36];
char searchname[39];
char changed=0;
int x;
int y;
long pos=0;
strcpy(first,bf);
rstrip(first);
lstrip(first);
if (!strlen(first)) return;
strtok(first," ");
p=strtok(0," ");
if (p==NULL) *last=0;
else strcpy(last,p);
lstrip(last);
if (*last) sprintf(searchname,"%s, %s",last,first);
else strcpy(searchname,first);
pos=0;
if (isalpha(*searchname)) {
sprintf(s,"%sFidoUser.IDX",nodepath);
if ((fp=_open(s,O_RDONLY | O_BINARY | O_DENYNONE))!=-1) {
lseek(fp,(long)((toupper(*searchname)-'A')*sizeof(long)),SEEK_SET);
_read(fp,&pos,sizeof(long));
_close(fp);
}
}
sprintf(s,"%sFidoUser.LST",nodepath);
if ((fp=_open(s,O_RDONLY | O_TEXT | O_DENYNONE))==-1) {
any_message(" No FidoUser.Lst available ");
pause();
return;
}
setmode(fp,O_TEXT);
lseek(fp,pos,SEEK_SET);
any_message(" Searching... ");
while (!eof(fp)) {
pos=tell(fp);
if (!fgetsx(s,128,fp)) break;
s[39]=0;
rstrip(s);
lstrip(s);
if (!stricmp(s,searchname)) {
lseek(fp,pos,SEEK_SET);
fgetsx(s,128,fp);
p=&s[41];
s[40]=0;
rstrip(s);